package com.learning.rpc.rpc;

import java.io.Serializable;
import java.util.concurrent.atomic.AtomicLong;

/**
 * ClassName: Invocation
 * Description: RPC Invocation 内容
 * Date: 2022/5/10 23:33 【需求编号】
 *
 * @author Sam Sho
 * @version V1.0.0
 */
public class Invocation implements Serializable {
    
    private static final long serialVersionUID = 3073469036914552024L;

    static AtomicLong SEQ = new AtomicLong();

    private long id;
    /**
     * 方法名
     */
    private String methodName;
    /**
     * 服务名
     */
    private String serviceName;
    /**
     * 参数类型
     */
    private Class<?>[] parameterTypes;
    /**
     * 参数
     */
    private Object[] arguments;

    public Invocation() {
        this.setId(incrementAndGet());
    }

    long incrementAndGet() {
        return SEQ.incrementAndGet();
    }

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getMethodName() {
        return methodName;
    }

    public void setMethodName(String methodName) {
        this.methodName = methodName;
    }

    public String getServiceName() {
        return serviceName;
    }

    public void setServiceName(String serviceName) {
        this.serviceName = serviceName;
    }

    public Class<?>[] getParameterTypes() {
        return parameterTypes;
    }

    public void setParameterTypes(Class<?>[] parameterTypes) {
        this.parameterTypes = parameterTypes;
    }

    public Object[] getArguments() {
        return arguments;
    }

    public void setArguments(Object[] arguments) {
        this.arguments = arguments;
    }
}
